<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>销售模块-订单信息</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="stylesheet" href="${s.base}/js/layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="${s.base}/css/base/base.css" media="all" /></head>

<body class="childrenBody">
<form class="layui-form">
	<blockquote class="layui-elem-quote quoteBox" id="tool">
		<div class="layui-inline">
			<label class="layui-input-inline">商品名称</label>
			<label class="layui-input-inline">
				<input type="text" class="layui-input" name="productName" placeholder="请输入商品名称" /></label>
			<label class="layui-input-inline">所属分类</label>
			<label class="layui-input-inline">
				<select name="productColId" id="productColId"></select>
			</label>
			<a class="layui-btn search_btn" lay-submit="" lay-filter="seacherBtn">搜索</a></div>
	</blockquote>
	<table id="entityList" lay-filter="entityList"></table>
</form>
<script type="text/javascript" src="${s.base}/js/layui/layui.js"></script>
<script type="text/javascript" src="${s.base}/js/base/base.js"></script>
<script type="text/javascript">layui.use(['jquery', 'pageUtil', 'table', 'dateUtil'],
    function() {
        var $ = layui.jquery,
            dateUtil = layui.dateUtil,
            table = layui.table,
            pageUtil = layui.pageUtil;
        var tableIns = null;
        pageUtil.initDictByUrl("/saleColumn/acceptSelect","sale_column_type",function (dictDataUrl) {
            pageUtil.showDict($("#productColId"), pageUtil.aceeptDictContentList(dictDataUrl, "sale_column_type"), "请选择所属分类");
            var url = "/saleDetail/myPage";
            var cols = [{
                type: 'checkbox',
                fixed: 'left'
            },
                {
                    type: 'numbers',
                    title: '序号'
                },
                {
                    field: 'productName',
                    title: '商品名称',
                    width: 190,
                    align: 'center'
                },
                {
                    field: 'productColId',
                    title: '所属分类',
                    width: 110,
                    align: 'center',
                    templet: function(d) {
                        return pageUtil.aceeptDictContentName(dictDataUrl, 'sale_column_type', d.productColId);
                    }
                },
                {
                    field: 'money',
                    title: '购买价格',
                    width: 100,
                    align: 'center'
                },
                {
                    field: 'endTime',
                    title: '商品到期时间',
                    width: 160,
                    align: 'center',
                    templet: function(d) {
                        return dateUtil.formatDate(new Date(d.endTime), "yyyy-MM-dd hh:mm:ss");
                    }
                },
                {
                    field: 'createTime',
                    title: '购买时间',
                    width: 190,
                    align: 'center',
                    templet: function(d) {
                        return dateUtil.formatDate(new Date(d.createTime), "yyyy-MM-dd hh:mm:ss");
                    }
                },
                {
                    field: 'remarks',
                    title: '备注',
                    width: 490,
                    align: 'left'
                }];
            tableIns = pageUtil.initDate(cols, url, true);
        });

        table.on('tool(entityList)',
            function(obj) {
                var layEvent = obj.event,
                    data = obj.data;
                if (layEvent === 'edit') {
                    pageUtil.editPopup("编辑", "/saleDetail/getEntity?id=" + data.id);
                } else if (layEvent === 'del') {
                    pageUtil.delete("确定删除该项吗？", "/saleDetail/delete", {
                            "id": data.id,
                            "_method": "DELETE"
                        },function(data) {
                            tableIns.reload();
                        });
                }
            });
    })</script>
</body>

</html>